package cn.gson.fengboot.model.service;

import cn.gson.fengboot.model.LpojosVo.LspVo;
import cn.gson.fengboot.model.dao.LshenpiDao;
import cn.gson.fengboot.model.dao.LxsfyDao;
import cn.gson.fengboot.model.mapper.LshenpiMapper;
import cn.gson.fengboot.model.pojos.Lshenpi;
import cn.gson.fengboot.model.pojos.Lxsfy;
import cn.gson.fengboot.model.pojos.QempFrom;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional(rollbackFor =  Exception.class)
public class LshenpiService {

    @Autowired
    LshenpiMapper lshenpiMapper;
    @Autowired
    LshenpiDao lshenpiDao;
    @Autowired
    LxsfyDao lxsfyDao;

    //查询所有审批信息
    public List<Lshenpi> selectsp(String vv,String spr){
        List<Lshenpi> lshenpis = lshenpiMapper.selectsp(vv,spr);
        return lshenpis;
    }


    //修改审批状态
    @Transactional(transactionManager = "transactionManager")
    public  void xiugailxsfy(Lxsfy lxsfy){
        lxsfyDao.save(lxsfy);
    }




    //修改
    public void xgsp(String spzt,Integer empid,String date,String spid){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date date1=sdf.parse(date);
            lshenpiMapper.xgshenpi(spzt,empid,date1,spid);
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }

    public void xgxsfy(String spzt,Integer xsfyid){
        lshenpiMapper.xgxsfy(spzt,xsfyid);
    }

    public void xgchucha(String spzt,Integer ccid){
        lshenpiMapper.xgchucha(spzt,ccid);
    }

    public void xghuanhuo(String spzt,Integer huamhuoid){
        lshenpiMapper.xghuanhuo(spzt,huamhuoid);
    }

    public void xgcaigou(String spzt,Integer caigouid){
        lshenpiMapper.xgcaigou(spzt,caigouid);
    }

    public void xgdoffer(String spzt,Integer baojiaid){
        lshenpiMapper.xgdoffer(spzt,baojiaid);
    }

    public void xgtuihuo(String spzt,Integer tuihuoid){
        lshenpiMapper.xgtuihuo(spzt,tuihuoid);
    }


}
